package com.bluegalaxy.sitescore.controller;

import com.alibaba.fastjson.JSONArray;
import com.bluegalaxy.sitescore.entity.TbMessage;
import com.bluegalaxy.sitescore.service.ITbMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/message")
public class MessageController extends BaseController{

    @Autowired
    private ITbMessageService messageService;

    @com.baomidou.kisso.annotation.Permission("1001")
    @RequestMapping(value = "/read",method = RequestMethod.POST)
    public @ResponseBody
    String MessageRead(String messageList){
        boolean rlt = false;
        List<TbMessage> messages = JSONArray.parseArray(messageList,TbMessage.class);
        rlt = messageService.updateMessageRead(messages);
        return callbackSuccess(rlt);
    }


}
